<layout name="site" />
  <h3 class="mt10 tc sy">{$category.name}</h3>
  <section class="lists wrapper mt10 ms ren-list"  id="ren-list"></section>
  <input type="hidden" id="add-num" value="2"/>

<script>

  var id={$cat_id};
  var sid={$Think.get.sid};
  var ourl="{:U('Article/more')}";
  var oRenList = document.getElementById( 'ren-list' ),
      oRenB = oRenList.getElementsByTagName( 'b' ),
      oRenValue=null;
     function getDate(tm){
       var tt=new Date(parseInt(tm) * 1000).toLocaleString()
       return tt;
     } 
     $.ajax({
       type:'POST',
       url:ourl,
       data:{id: id , sid :sid},
       success:function(data){
        for(var i = 0 ; i < data.extra.length ; i++){
           var oDiv = document.createElement( "div" );
               oDiv.className = 'lists-item job-list';
           oDiv.innerHTML= "<a href='" + data.extra[i].url + "'><p><span>" + data.extra[i].name + "</span><u>点击"
                           + data.extra[i].hits +"</u></p><p><u>发布日期&nbsp;&nbsp;<b>"
                           +     new Date(data.extra[i].update_time*1000).Format("yyyy-MM-dd hh:mm:ss") +"</b></u></p></a>";
           oRenList.appendChild(oDiv);
         }
       }  
    })
     window.onscroll=function(){
     if(($(document.body).height()-$(window).scrollTop()-$(window).height())<10){ 
           $.ajax({
           type:'POST',
           url:ourl,
           data:{id: id , sid :sid, p:$( '#add-num' ).val() },  
           success:function(data){
            if(data.extra.length != '0'){
            $('#add-num').val(Number($('#add-num').val())+1);//加载次数
            for(var i = 0 ; i < data.extra.length ; i++){
               var oDiv = document.createElement( "div" );
                   oDiv.className = 'lists-item job-list';
               oDiv.innerHTML= "<a href='" + data.extra[i].url + "'><p><span>" + data.extra[i].name + "</span><u>点击"
                               + data.extra[i].hits +"</u></p><p><u>发布日期&nbsp;&nbsp;<b>"
                               + getDate( data.extra[i].update_time ) +"</b></u></p></a>";
               oRenList.appendChild(oDiv);
             }
            }else{
              GH.showMessage('已经没有数据了哦~');
            }
           }  
        })
      }; 
  }
</script>